home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / nrpas13.zip / SHELL.DEM < prev    next >
Text File  |  1991-04-29  |  742b  |  35 lines

  1. PROGRAM d8r9(input,output,dfile);
  2. (* driver for routine SHELL *)
  3. CONST
  4.    npt=100;
  5. TYPE
  6.    glnarray = ARRAY [1..npt] OF real;
  7. VAR
  8.    i,j : integer;
  9.    a : glnarray;
  10.    dfile : text;
  11.  
  12. (*$I MODFILE.PAS *)
  13. (*$I SHELL.PAS *)
  14.  
  15. BEGIN
  16.    glopen(dfile,'tarray.dat');
  17.    readln(dfile);
  18.    FOR i := 1 to npt DO read(dfile,a[i]);
  19.    close(dfile);
  20. (* write original array *)
  21.    writeln('Original array:');
  22.    FOR i := 1 to (npt DIV 10) DO BEGIN
  23.       FOR j := 1 to 10 DO write(a[10*(i-1)+j]:6:2);
  24.       writeln
  25.    END;
  26. (* write sorted array *)
  27.    shell(npt,a);
  28.    writeln;
  29.    writeln('Sorted array:');
  30.    FOR i := 1 to (npt DIV 10) DO BEGIN
  31.       FOR j := 1 to 10 DO write(a[10*(i-1)+j]:6:2);
  32.       writeln
  33.    END;
  34. END.
  35.